<template>
  <div class="stat-card" :style="{ background: bgColor }">
    <div class="card-title">{{ title }}</div>
    <div class="card-value">{{ value }}</div>
  </div>
</template>

<script>
export default {
  name: 'StatCard',
  props: {
    title: {
      type: String,
      required: true
    },
    value: {
      type: [String, Number],
      required: true
    },
    bgColor: {
      type: String,
      default: 'rgba(0, 0, 0, 0.5)' // 默认半透明背景
    }
  }
};
</script>

<style scoped>
.stat-card {
  padding: 16px;
  border-radius: 8px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-in-out;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.card-title {
  font-size: 14px;
  margin-bottom: 8px;
}

.card-value {
  font-size: 24px;
  font-weight: bold;
}
</style>